<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								订单编号：<input type="text" name="orderNo"/>
							</li>
							<!-- <li>
								银行卡号：<input type="text" name="cardNo"/>
							</li> -->
							<li>
								代理名称：<input id="agentName" type="text" name="agentName"/>
										<input  type="hidden" id="agentNameList" value=""/><br>
							</li>
							<li>
								用户编号：<input type="text" name="merchantNo"/>
										<input  type="hidden" id="agentNameList" value=""/><br>
							</li>
							<li>
								交易类型：<select name="tradeType" th:with="type=${@dict.getType('trade_type')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								交易状态：<select name="sTATUS" th:with="type=${@dict.getType('trade_status')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li class="select-time">
								<label>完成时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>

							<li>
								<a id="btnSearch" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	       <!-- 	<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:hatchetOrderPayment:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div> -->
			<div class="col-sm-12 select-table table-striped">
				<font><b>订单总金额：</b><span id="spanSumMoney" > </span>元</font>
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:hatchetOrderPayment:edit')}]];
        var settleStatus = [[${@dict.getType('settleList_status')}]];
        var tradeType = [[${@dict.getType('trade_type')}]];
        var tradeStatus = [[${@dict.getType('trade_status')}]];
        var prefix = ctx + "system/hatchetOrderPaymentForDLS";
        var prefix1 = ctx + "system/hatchetAgent";
    	var agentNameList = [];
        $(function() {
        	//点击总金额清零
        	$("#btnSearch").click(function(){
        		$("#spanSumMoney").text(0);
        	});
        	agents();
         	//代理商名称自动补全
         	$("#agentName").autocomplete({
        		source: agentNameList
        	});
        	
            var options = {
                url: prefix + "/list/1",
				exportUrl: prefix + "/export",
                modalName: "订单",
				search: false,
		        showExport: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : '订单ID', 
					title : '',
					visible: false
				},
				{
					field : 'orderNo', 
					title : '订单号',
					sortable: true
				},
				
				{
					field : 'merchantName', 
					title : '用户名称',
					sortable: false
				},
				{
					field : 'merchantNo', 
					title : '用户编号',
					sortable: false
				},
				{
					field : 'agentName', 
					title : '代理商名称',
					sortable: false
				},
				/* {
					field : 'agentNo', 
					title : '代理商编号',
					sortable: false
				}, */
				{
					field : 'track3', 
					title : '费率',
					sortable: true
				},
				
				{
					field : 'tradeType', 
					title : '交易类型',
					align : 'left',
					formatter: function(value, item, index) {
						if(item.sumMoney != null){
	            			$("#spanSumMoney").text(item.sumMoney);
	            		} 
	            		return $.table.selectDictLabel(tradeType, item.tradeType);
	            	} 
				},
				{
					field : 'trxAmt', 
					title : '交易金额(元)',
					sortable: true
				},
				{
					field : 'completeTime', 
					title : '完成时间',
					sortable: true
				},
				{
					field : 'status', 
					title : '交易状态',
					align : 'left',
					formatter: function(value, item, index) {
	            		return $.table.selectDictLabel(tradeStatus, item.status);
	            	} 
				},
				{
					field : 'acqResponseCode', 
					title : '终端返回码',
					sortable: false
				},
				{
					field : 'acqResponseMsg', 
					title : '终端返详情',
					sortable: false
				},
				{
					field : 'cardNo', 
					title : '银行卡号',
					sortable: true
				},
				{
					field : 'issBankId', 
					title : '银行简称',
					sortable: false
				},
			/* 	{
					field : 'acqNo', 
					title : '通道编号',
					sortable: false
				},
				{
					field : 'acqName', 
					title : '通道名称',
					sortable: false
				} */]
            };
            $.table.init(options);
        });
        
      //查找全部下级代理商
 		function agents(){
    		var array=[];
			$.ajax({
				url: prefix1 + "/getAgentBydepartCode",
				async:false,
				type:"POST",
				data:{},
				success: function(result) {
					$.each(result, function(i,v) {
						if (v.agentName != null && v.agentName != undefined) {
							agentNameList.push(v.agentName);
							var arrays = {};
							arrays.value = v.agentName;
							arrays.id = v.id;
							array.push(arrays);
						}
					});
				}
			});
			return array;
    	} 
    </script>
</body>
</html>